#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char* argv[])
{
    int slave = open(argv[1], O_RDWR);   // shell
    
    if( slave > 0 )
    {
        char buf[256] = {0};
        char* data = "D.T.Software\r";
        int len = strlen(data);
        
        write(slave, data, len);
        
        sleep(1);
        
        len = read(slave, buf, sizeof(buf) - 1);
        buf[(len > 0) ? len : 0] = 0;
        
        printf("Read: %s\n", buf);   // system(...)
        
        close(slave);
    }
    
    
    return 0;
}
